<?php
require_once "managerSession.php";
$Item="业绩报表";
if(isset($_REQUEST["page"])){
    $page=$_REQUEST["page"];
}else{
    $page=1;
}


$pageCount=ceil($core->GetUsersAndMonthExpendCount()/20);
$arr=$core->GetUsersAndMonthExpend($page);

?>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>娱乐会所吧台管理系统</title>
    <?php include_once "link.php"; ?>
</head>
<body  class="container">
<?php require_once "Nav.php"; ?>
<div class="main">
    <?php include_once "menu.php"; ?>
    <div class="pr inlb bd col-xs-10">
        <table class="table table-striped">
            <caption>
                业绩报表
                <span class="pull-right" style="font-size: 20px;border: 0;margin:30px 50px 0 0">当月消费：<?php echo $core->GetAllMonthexpendSUM(); ?>;总消费：<?php echo $core->GetAllexpendSUM(); ?>
                <button  type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-sm">下载报表</button>
                </span>
            </caption>
            <tr>
                <th>姓名</th>
                <th>微信</th>
                <th>手机</th>
                <th>当月消费</th>
                <th>总消费</th>
                <th>当月佣金</th>
                <th>总佣金</th>
            </tr>
            <?php

            for($i=0;$i<count($arr);++$i){
            ?>
            <tr>
                <td><?php echo $arr[$i]["name"]; ?></td>
                <td><?php echo $arr[$i]["weixin_Id"]; ?></td>
                <td><?php echo $arr[$i]["phone"]; ?></td>
                <td><?php echo $arr[$i]["mExpend"]; ?></td>
                <td><?php echo $arr[$i]["expend"]; ?></td>
                <td><?php echo $arr[$i]["mBonus"]; ?></td>
                <td><?php echo $arr[$i]["bonus"]; ?></td>
            </tr>
            <?php } ?>
        </table>
        <div class="pager">
            <?php
           pageList($pageCount, $page, "");
            ?>
        </div>
    </div>
</div>
<div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <div class="modal-header">
                <div class="title">报表选择</div>
            </div>
            <div class="modal-body" style="text-align: center">
                <select id="type">
                    <option value="expend">消费记录报表</option>
                    <option value="bonus">佣金提现报表</option>
                </select>
                <select id="time">
                    <option value="lm">上月份</option>
                    <option value="m">本月份</option>
                    <option value="ly">上年度</option>
                    <option value="y">本年度</option>
                </select>
                <button id="download">下载</button>
            </div>
        </div>
    </div>
</div>
<script>
    $('#download').click(function(){
        var type=$('#type').val();
        var time=$('#time').val();
        location.href='fun_download.php?type='+type+'&time='+time;
    });
</script>
</body>
</html>
